package org.obm.mina;

import java.io.File;
import java.io.IOException;

/**
 * Handles storage of received binary files
 * 
 * @author tom
 *
 */
public class StoreManager {

	private static StoreManager inst = new StoreManager();

	public static StoreManager getInstance() {
		return inst;
	}

	public void quietDelete(Blob blob) {
		blob.getFile().delete();
	}

	public BlobBuilder getBlobBuilder() throws ServiceException {
		File tmp = null;
		try {
			tmp = File.createTempFile("blob", ".bin");
			return new BlobBuilder(new Blob(tmp));
		} catch (IOException e) {
			throw new ServiceException(e.getMessage(), e);
		}
	}

}
